﻿Imports System.Windows.Input

Namespace ViewModel
    Public Class WorkspaceViewModel
        Inherits AbstractViewModel

#Region "Properties"

        Private _current As Boolean
        Public Property IsCurrent() As Boolean
            Get
                Return _current
            End Get
            Set(ByVal value As Boolean)
                _current = value
            End Set
        End Property

#End Region

#Region "RequestClose [event]"

        ''' <summary>
        ''' Raised when this workspace should be removed from the UI.
        ''' </summary>
        Public Event RequestClose As EventHandler

        Private Sub OnRequestClose()
            Dim handler As EventHandler = Me.RequestCloseEvent
            If handler IsNot Nothing Then
                handler(Me, EventArgs.Empty)
            End If
        End Sub

#End Region ' RequestClose [event]

#Region "CloseCommand"

        Private _closeCommand As SimpleCommand

        ''' <summary>
        ''' Returns the command that, when invoked, attempts
        ''' to remove this workspace from the user interface.
        ''' </summary>
        Public ReadOnly Property CloseCommand() As ICommand
            Get
                If _closeCommand Is Nothing Then
                    Dim requestCloseAction As New Action(Of Object)(AddressOf OnRequestClose)
                    _closeCommand = New SimpleCommand(requestCloseAction)
                End If

                Return _closeCommand
            End Get
        End Property

#End Region ' CloseCommand

    End Class
End Namespace
